<%include file="header.html"%>
<%include file="top.html"%>
<%include file="left.html"%>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="javascript:void(0);">游戏管理</a>
							</li>
							<li class="active"><a href="javascript:void(0);">管理游戏</a></li>
						</ul><!-- .breadcrumb -->
					</div>

					<div class="page-content">

						<div class="row">
							<div class="col-xs-12">
								<div class="alert alert-info">
									<i class="icon-hand-right"></i>

									<strong class="red">请注意：</strong><i class="icon-ok bigger-120"></i> 为保存，<i class="icon-trash bigger-120"></i> 为删除
									<button class="close" data-dismiss="alert">
										<i class="icon-remove"></i>
									</button>
								</div>
								<div class="table-header">
											<a style="display:none" id="addGame" href="index.php?mod=Game&do=addGame"  class="pull-left"> -->
													<font class="white"><i class="icon-user-md"></i>&nbsp;添加游戏 
													 </font>
								</a>
									
							  	<button class="btn btn-primary"  onclick="document.getElementById('addGame').click();return false;" >
							<!--  		<a  href="index.php?mod=Bucket&do=makeDir&bucketId=<%$bucketId%>&parentNodeId=<%$parentNodeId%>"  class="pull-left"> -->
													<font class="white"><i class="icon-user-md"></i>&nbsp;添加游戏    
													 </font>
							<!--		</a> -->
								</button>
								
								
								&nbsp;&nbsp;&nbsp;&nbsp;</div>

								<div class="table-responsive">
									<table id="sample-table-1" class="table table-striped table-bordered table-hover">
										<thead>
											<tr>
												<th >游戏名称</th>
												<th>支持平台</th>
												<th  >
													支持渠道
												</th>

												<th>日志用户</th>
												<th>日志密码</th>
												<th>部署路径</th>		
												<th>脚本端口</th>
												<th>操作</th>
											</tr>
										</thead>

										<tbody>
											<%foreach from=$gameList item=gameInfo%>
											<tr>
												<td class="col-xs-1"><input  style="width:100%;" disabled='disabled'  type="text" id="<%$gameInfo.game%>" value="<%$gameInfo.game%>" /></td>
												<td><input type="text" id="<%$gameInfo.game%>_platform" value="<%$gameInfo.platform%>" /></td>
												<td class="col-xs-4" ><input type="text" id="<%$gameInfo.game%>_channel" value="<%$gameInfo.channel%>" class="col-xs-12" /></td>
												<td class="col-xs-1"><input style="width:80%;" type="text" id="<%$gameInfo.game%>_logUserName" value="<%$gameInfo.logUserName%>" /></td>
												<td class="col-xs-1"><input style="width:80%;" type="text" id="<%$gameInfo.game%>_logUserPwd" value="<%$gameInfo.logUserPwd%>" /></td>	
												<td class="col-xs-2"><input style="width:90%;" type="text" id="<%$gameInfo.game%>_logPath" value="<%$gameInfo.logPath%>" /></td>
												<td class="col-xs-1"><input style="width:100%;" type="text" id="<%$gameInfo.game%>_sshPort" value="<%$gameInfo.sshPort%>" /></td>	
												<td class="col-xs-1">
													<!--<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">-->
													<div style="width:100%;" class="visible-md visible-lg hidden-sm hidden-xs action-buttons">

														<a class="green" href="javascript:void(0);" onClick="formSubmit('save', '<%$gameInfo.game%>');" >
															&nbsp;&nbsp;&nbsp;<i class="icon-ok bigger-130"></i>保存
														</a>

<!--  
														<a class="red" href="javascript:void(0);" onClick="formSubmit('del', <%$gameInfo.game%>);" >
															<i class="icon-trash bigger-130"></i>
														</a>
-->		
													</div>
													<!-- 
													<div class="visible-xs visible-sm hidden-md hidden-lg">
														<div class="inline position-relative">
															<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
																<i class="icon-caret-down icon-only bigger-120"></i>
															</button>

															<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																<li>
																	<a href="javascript:void(0);" class="tooltip-success" data-rel="tooltip" title="" data-original-title="Edit">
																		<span class="green">
																			<i class="icon-ok bigger-120"></i>
																		</span>
																	</a>
																</li>

																<li>
																	<a href="javascript:void(0);" class="tooltip-error" data-rel="tooltip" title="" data-original-title="Delete">
																		<span class="red">
																			<i class="icon-trash bigger-120"></i>
																		</span>
																	</a>
																</li>
															</ul>
														</div>
													</div>
													 -->
												</td>
											</tr>
											<%/foreach%>
										</tbody>
									</table>
								</div><!-- /.table-responsive -->
							</div><!-- /span -->
						</div><!-- /row -->

					</div><!-- /.page-content -->
				</div><!-- /.main-content -->

		<script type="text/javascript">

			function formSubmit(type, gameId) {
				
				var param = {};
				param['mod'] = 'Game';
				param['do'] = 'addGame';
				param['game'] = gameId;
				param['type'] = type;
				if (type == 'save') {
					param['platform'] = $('#' + gameId + '_platform').val();
					param['channel'] = $('#' + gameId + '_channel').val();
					param['logUserName'] = $('#' + gameId + '_logUserName').val();
					param['logUserPwd'] = $('#' + gameId + '_logUserPwd').val();
					param['logPath'] = $('#' + gameId + '_logPath').val();
					param['sshPort'] = Number($('#' + gameId + '_sshPort').val());  // 转为num
				}
						
			//	url = "http://182.254.230.39:9001/create_game?game="+gameId+"&platform="+param['platform']+"&channel="+param['channel']+"&logUserName="+param['logUserName']+"&logUserPwd="+param['logUserPwd']+"&logPath="+param['logPath']+"&logUserPwd="+param['logUserPwd']+"&sshPort="+param['sshPort'];
				
				$.ajax({
					type:'POST',
					url:'index.php',
					data:param,
					dataType:'html',
					success:function(data) {
					
						var dataObj = eval("(" + data + ")");//转换为json对象
						if (dataObj.code != 1) {
							alert(dataObj.msg);
						} else {
							alert(dataObj.msg);
							window.location.href("index.php?mod=Game&do=showGameList");
						}
					}
				});
				
			}
		</script>
<%include file="footer.html"%>
